package com.heer.gymnasium.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.heer.gymnasium.R;
import com.heer.model.SiteOfferBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by rzw2 on 2017/4/5.
 */

public class SiteDetailsRechargeAdapter extends ListAdapter<SiteOfferBean> {
    private int count;

    public SiteDetailsRechargeAdapter(Context context) {
        super(context);
    }

    @Override
    public int getCount() {
        return count;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        ViewHolder holder;
        if (view != null) {
            holder = (ViewHolder) view.getTag();
        } else {
            view = mInflater.inflate(R.layout.item_sites_recharge, parent, false);
            holder = new ViewHolder(view);
            view.setTag(holder);
        }

        SiteOfferBean item = getItem(position);

        holder.tvDesc.setText("充值" + item.getMoney() + "元，送" + item.getGift() + "元");


        return view;
    }

    public void setCount(int count) {
        this.count = count;
        notifyDataSetChanged();
    }

    static class ViewHolder {
        @BindView(R.id.image)
        ImageView image;

        @BindView(R.id.tv_desc)
        TextView tvDesc;

        @BindView(R.id.image_arrow)
        ImageView imageArrow;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
